#include <REGX52.H>
#include "Delay.h"

sbit SER=P3^4;  //SER  
sbit RCK=P3^5; //RCLK 
sbit SCK=P3^6;  //SRCLK  移位



void _74HC595_WriteByte(unsigned char Byte)
{
	unsigned char i;
	for(i=0;i<8;i++)
	{
			SER=Byte&(0x80>>i);
		SCK=1;
		SCK=0;
	}
	RCK=1;
		RCK=0;
}



void  MatrixLED_ShowColumn(unsigned char Column,Data)
{
	
  _74HC595_WriteByte(Data);
	P0=~(0x80>>Column);
	Delay(1);
	P0=0xFF;
}



void main()
{
	RCK=0;
	SCK=0;
	
	while(1)
	{
		MatrixLED_ShowColumn(0,0x38);
		MatrixLED_ShowColumn(1,0x44);
		MatrixLED_ShowColumn(2,0x82);
		MatrixLED_ShowColumn(3,0x41);
		MatrixLED_ShowColumn(4,0x41);
		MatrixLED_ShowColumn(5,0x82);
		MatrixLED_ShowColumn(6,0x44);
		MatrixLED_ShowColumn(7,0x38);	
	}
}
